#!/usr/bin/python

import sys
from honeycomb_pointers_v1 import *
from pointers_to_sequences_v1 import *

filename = raw_input('Enter the filename for the text-based node lattice array: ')
num_zones = int(raw_input('Enter the number of 42bp zones per double helix: '))

sequence_chunk = raw_input('Enter the filename for the sequence chunk you are using: ')
output_name = raw_input('Enter the name of the file you would like to output to: ')

#filename = 'node_ra_for_30hb.txt'
#num_zones = 3
periodic_structure_flag = False

node_ra = read_text_format_node_array(filename)
print_node_lattice_array(node_ra)
TPP_ra = token_pointer_pair_array(node_ra, num_zones, periodic_structure_flag)
path_ra = token_pointer_path_array(TPP_ra)
OTP_ra = oligo_token_pointer_array(path_ra)
check_token_representation(OTP_ra, TPP_ra)


# Print out the longest path, just for fun
longest_path = []
for path in path_ra:
	if len(path) > len(longest_path):
		longest_path = path
print_path(longest_path, TPP_ra)


# Generate oligos
strand_ra = strand_array(sequence_chunk, TPP_ra)
token_ra = token_array(strand_ra)
oligo_ra = oligo_array(OTP_ra, token_ra)


output_file = file(output_name, 'w')
for oligo in oligo_ra:
	output_file.write(oligo + '\n')
output_file.close()


sys.stdout.write('\n\n\n\n\n\n')

